package com.example.custom.rpc.register;

import com.example.custom.rpc.common.URL;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * @author liyuncong
 * @version 1.0
 * @file MapRemoteRegister
 * @brief MapRemoteRegister
 * @details MapRemoteRegister
 * @date 2022-11-06
 *
 * Edit History
 * ----------------------------------------------------------------------------
 * DATE                     NAME               DESCRIPTION
 * 2022-11-06               liyuncong          Created
 */
public class MapRemoteRegister {

    private static HashMap<String, List<URL>> map = new HashMap<>();

    public static void register(String interfaceName, URL url) {
        List<URL> urls = map.get(interfaceName);
        if (null == urls) {
            urls = new ArrayList<>();
        }
        urls.add(url);

        map.put(interfaceName, urls);
    }

    public static List<URL> get(String interfaceName) {
        return map.get(interfaceName);
    }

}
